//
//  WSLTableViewCell.m
//  ShreddedBread
//
//  Created by lanou3g on 16/8/15.
//  Copyright © 2016年 云之君兮鹏. All rights reserved.
//

#import "WSLTableViewCell.h"
#import <AVFoundation/AVFoundation.h>
#import <AVKit/AVKit.h>

@interface WSLTableViewCell ()
@property(strong,nonatomic) AVPlayer *player; //视频播放器
@property(assign,nonatomic) CGFloat sumplayOperation; //播放总时长


@end

@implementation WSLTableViewCell

-(void)playVideo{
    
    NSString *playString = @"http://qiubai-video.qiushibaike.com/WLJE4YIGEII00UVP.mp4";
    NSURL *url = [NSURL URLWithString:playString];

    AVPlayerItem *item = [[AVPlayerItem alloc]initWithURL:url]; //设置播放的项目
    self.player = [[AVPlayer alloc]initWithPlayerItem:item]; //初始化player对象
    AVPlayerLayer *layer = [AVPlayerLayer playerLayerWithPlayer:_player]; //设置播放页面
    layer.frame = CGRectMake(0, 0, self.videoView.frame.size.width, self.videoView.frame.size.height); //播放页面大小
    layer.backgroundColor = [UIColor cyanColor].CGColor;
    [self.videoView.layer addSublayer:layer]; //添加播放视图到self.videoView
    
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
